package com.rowenci.iot_agriculture.mapper;

import com.rowenci.iot_agriculture.bean.iot.Com;
import org.springframework.data.jpa.repository.JpaRepository;

import javax.transaction.Transactional;
import java.util.List;

public interface ComDao extends JpaRepository<Com, Integer> {

    Com findComByComName(String comName);

    List<Com> findComsBySensor(String sensor);

    List<Com> findAllBySensorNot(String sensor);

    List<Com> findComsByHouseIdAndSensorIsNot(Integer house_id, String sensor);

    @Transactional
    void deleteComsByHouseId(Integer house_id);

    List<Com> findComsByHouseId(Integer house_id);

    Com findComByHouseIdAndSensorIs(Integer houseId, String sensorName);

    Com findComByHouseId(Integer house_id);

    Com findComById(Integer id);

}
